#define _GNU_SOURCE
#include <stdio.h>
#include <dlfcn.h>
#include <stdlib.h>
#include <memory.h>

// Pointer to the original free() call
static void (*_free)(void *) = NULL;

void free(void *addr)
{
	printf("shared object free get called!\n");

	//initialization
	if(_free == NULL)
	{
		_free = (void(*)(void *))dlsym(RTLD_NEXT, "free");
	}

	_free(addr);
	_free = NULL;
}
